/*
 * @lc app=leetcode.cn id=441 lang=cpp
 *
 * [441] 排列硬币
 */

// @lc code=start
class Solution
{
public:
  int arrangeCoins(int n)
  {
    int row = 1;
    while (n >= row) {
      n -= row;
      ++row;
    }
    return row - 1;
  }
};
// @lc code=end
